def dfs(nums,start,path,ans,n):
    ans.append(path[:])
    if start==n: return 
    for i in range(start,n):
        path.append(nums[i])
        dfs(nums,i+1,path,ans,n)
        path.pop()
    
def solve(nums):
    n=len(nums)
    ans=[]
    dfs(nums,0,[],ans,n)
    return ans

nums=[1,2,3]
print(solve(nums))
nums=[0]
print(solve(nums))